aggregation sorts groups by a metric and takes the top N